package com.wc.acwing.贪心.礼物;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/3/24 16:48
 * @description https://www.acwing.com/problem/content/description/2042/
 */

public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 1010;
    static int[][] a = new int[N][2];
    static int n, B;

    public static void main(String[] args) {
        n = sc.nextInt();
        B = sc.nextInt();
        for (int i = 1; i <= n; i++) {
            a[i][0] = sc.nextInt();
            a[i][1] = sc.nextInt();
        }
        Arrays.sort(a, 1, n + 1, Comparator.comparingInt(o -> o[0] + o[1]));
        int res = 0;
        for (int i = 1; i <= n; i++) {
            // 用优惠券
            int curB = B, curRes = 0;
            if (curB >= a[i][0] / 2 + a[i][1]) {
                curB -= a[i][0] / 2 + a[i][1];
                curRes++;
            }
            for (int j = 1; j <= n; j++) {
                if (i == j) continue;
                if (curB >= a[j][0] + a[j][1]) {
                    curB -= a[j][0] + a[j][1];
                    curRes++;
                } else break;
            }
            res = Math.max(res, curRes);
        }

        out.println(res);
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
